local kailu = fk.CreateSkill {
  name = "lingling__kailu",
}

Fk:loadTranslationTable{
  ["lingling__kailu"] = "开颅",
  [":lingling__kailu"] = "出牌阶段限一次，你可以令一名距离为1的其他角色选择：弃置两张牌，对你造成1点伤害；你对其造成2点伤害，然后其摸三张牌。",

  ["#lingling__kailu"] = "开颅：令一名距离1的角色选择：弃两张牌对你造成1点伤害，或你对其造成2点伤害且其摸三张牌",
  ["#lingling__kailu-discard"] = "开颅：弃置两张牌对 %src 造成1点伤害，或点“取消”其对你造成2点伤害且你摸三张牌",
}

kailu:addEffect("active", {
  anim_type = "offensive",
  prompt = "#lingling__kailu",
  card_num = 0,
  target_num = 1,
  can_use = function(self, player)
    return player:usedSkillTimes(kailu.name, Player.HistoryPhase) == 0
  end,
  card_filter = Util.FalseFunc,
  target_filter = function(self, player, to_select, selected, selected_cards)
    return #selected == 0 and player:distanceTo(to_select) == 1
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    if #room:askToDiscard(target, {
      min_num = 2,
      max_num = 2,
      skill_name = kailu.name,
      include_equip = true,
      cancelable = true,
      prompt = "#lingling__kailu-discard:"..player.id,
    }) == 2 then
      if not player.dead then
        room:damage {
          from = target,
          to = player,
          damage = 1,
          skillName = kailu.name
        }
      end
    else
      room:damage {
        from = player,
        to = target,
        damage = 2,
        skillName = kailu.name
      }
      if not target.dead then
        target:drawCards(3, kailu.name)
      end
    end
  end,
})

return kailu
